#!/bin/sh

. $HOME/bin/config.sh

#停止tomcat
nohup $TOMCAT_HOME/bin/shutdown.sh &
#循环判断是否停止
int=1
while (( $int<=5 ))
do
    echo $int
    let "int++"
    echo "sleep ..."
    sleep 1
    ps=`jps | grep Bootstrap | awk '{print $1}' `
    if [ "$ps" = "" ] ; then
        break;
    fi
done
#循环结束后判断是否停止
ps=`jps | grep Bootstrap | awk '{print $1}' `
if [ "$ps" != "" ] ; then
    kill -9 $ps
    checkErr $? "停止tomcat"
fi
#jps | grep Bootstrap |awk '{print $1}' | xargs kill -9

#启动tomcat
$TOMCAT_HOME/bin/startup.sh 
checkErr $? "启动tomcat"
